<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/jsp/common.jsp"%>

<script type="text/javascript">
	var $mainModal = $("#main-loading");
	var log = {
		currentPage : 1,
		ajaxList : function(pageNum) {
			$mainModal.modal();
			$("#headBtnGroup").show();
			log.currentPage = pageNum;
			
			searchForm.pageNum.value = pageNum;
			
			$.ajax({
				url : '${basePath}/manage/log/list', 
				method: 'POST',
				data : $("#searchForm").serialize(), 
				dataType : 'html', 
				success : function(data) {
					$mainModal.modal("close");
					$("#tableBody").html(data);
				},
				error : function(data){
					$mainModal.modal("close");
					layer.msg("连接服务器时遇到错误！", {icon: 2});
				}
			}); 
		  
		},
		showSearchBox : function(){
			if($("#hideBar").css("display")=="none"){
				$("#hideBar").slideDown();
			}else{
				$("#hideBar").slideUp();
			}
		},
		search : function(){
			$mainModal.modal();
			searchForm.pageNum.value = 1;
			$.ajax({
				url : "${basePath}/manage/log/list", 
				method: 'POST',
				data : $("#searchForm").serialize(), 
				dataType : 'html', 
				success : function(data) {
					$mainModal.modal("close");
					$("#tableBody").html(data);
				},
				error : function(data){
					$mainModal.modal("close");
					layer.msg("连接服务器时遇到错误！", {icon: 2});
				}
			}); 
		},
		reset : function(){
			$("#searchForm")[0].reset();
			$("#startDate").val("");
			$("#endDate").val("");
		}
	};

	/** 
	 * 建立一个_this对象 
	 * 将查询列表的ajaxList方法赋值给$.ajaxList
	 * 公用分页插件将会使用这个方法分页
	 */
	var _this = {
		_ajaxList : log.ajaxList
	}

	$(document).ready(function() {
		log.ajaxList(1);
	});
</script>

<div class="admin-content-body">
	<div class="am-cf am-padding am-padding-bottom-0">
		<div class="am-fl am-cf">
			<strong class="am-text-primary am-text-lg">用户操作记录</strong> / <small>USER OPERATION LOG</small>
		</div>
	</div>
	<hr>
	<div class="main">
		<div class="am-g">
			<div class="am-u-sm-12" id="headBtnGroup">
				<button type="button" class="am-btn am-btn-default am-btn-xs am-fr"
					onclick="log.showSearchBox()">
					<span class="am-icon-search"></span> 搜索
				</button>
			</div>
		</div>
		<div class="am-g" style="margin-top: 10px;">
			<div id="hideBar" style="display: none;">
				<%@ include file="search.jsp"%>
			</div>
			<div class="am-u-sm-12 am-u-md-12" id="tableBody"></div>
		</div>
	</div>
</div>

<div class="am-modal am-modal-loading am-modal-no-btn" tabindex="-1" id="main-loading">
  <div class="am-modal-dialog">
    <div class="am-modal-hd">正在载入...</div>
    <div class="am-modal-bd">
      <span class="am-icon-spinner am-icon-spin"></span>
    </div>
  </div>
</div>